<html>
    <head>
        <title>C12TDT Works</title>
        <link href="public/css/style_web2.css" rel="stylesheet" type="text/css">
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <script type="text/javascript" src="public/jc/jquery-1.2.6.min.js"></script>
        <script type="text/javascript">
            function slideSwitch() {
                var $active = $('#baner IMG.active');
                if ($active.length == 0)
                    $active = $('#baner IMG:last');
                var $next = $active.next().length ? $active.next()
                        : $('#baner IMG:first');
                $active.addClass('last-active');
                $next.css({opacity: 0.0})
                        .addClass('active')
                        .animate({opacity: 1.0}, 1000, function() {
                    $active.removeClass('active last-active');
                });
            }
            $(function() {
                setInterval("slideSwitch()", 3000);
            });
        </script>
    </head>
    <body>
        <div id="wrapper">
            <?php
            require_once './model/works.php';
            $keyword = new Works();
            $keyword->table_name = "works";
            ?>
            <?php
            if (!isset($_GET["page"]))
                $page = 1;
            else
                $page = $_GET["page"];
            $total = $keyword->countWords();
            ?>
            <div id="sum">
                <div id="baner">
                    <img src="public/image/5-1394604835.jpg" alt="" class="active"/>
                    <img src="public/image/logo_2-1394601748.jpg" alt=""  />
                    <img src="public/image/1-1394604824.jpg" alt=""  />
                    <img src="public/image/2-1394604827.jpg" alt=""  />
                    <img src="public/image/3-1394604829.jpg" alt=""  />
                    <img src="public/image/4-1394604832.jpg" alt=""  />
                </div>

                <div id="boder"></div>
                <header>
                    <div class="logo">
                        <h1><b class="Works">C12TDT</b> Works</h1>
                        <p class="text_td">Thu Duc College of Tehnology</p>
                    </div>
                    <div id="boders"></div>
                    <div id="col_left">
                        <h4>Hôm nay  <?php echo date("m/d/Y"); ?></h4>
                        <p class="main_menu">
                        <h3>MAIN MENU</h3>
                        <div id="boder_menu"></div>
                        </p>
                        <nav>
                            <ul>
                                <li><a href="index.php">HOME</a></li>
                                <li><a href="#">CONTENT TYPES</a></li>
                                <li><a href="#">FORUMS</a></li>
                                <li><a href="#">CONTACT</a></li>
                            </ul>
                        </nav>
                        <p class="main_menu">
                        <h3>USER LOGIN</h3>
                        <div id="boder_menu"></div>
                        </p>
                        <p>User name</p>
                        <input type="text" name="user_name">
                        <p>Password <strong>*</strong></p>
                        <input type="password" name="password"></br>
                        <p id="input_st"><a href="#">Log in</a></p>
                    </div>
                    <section>
                        <p class="main_menus">
                        <h3>CONTENT</h3>
                        <div id="boder_menus"></div>
                        </p>
                        <div class="fanpage">      
                            <a href="index.php?page=1">Fist</a>
                                <a href="index.php?page=<?php echo $_GET['page'] = 1 ?>">Pre</a>
                            <?php $max_page = 7; ?>
                            <?php for ($i = 1; $i <= $max_page; $i++): ?>
                                <?php if (($_GET["page"] == 1) || ($_GET["page"] == 2) || ($_GET["page"] == 3) || ($_GET["page"] == 4)): ?>            
                                    <?php for ($i = 1; $i <= $max_page; $i++): ?>
                                        <a href='index.php?page=<?php echo $i; ?> '><?php echo $i ?></a>
                                        <?php if ($_GET["page"] == $i): ?>
                                            <?php $keyword->begin; ?>
                                            <?php $keyword->end = PAGE; ?>
                                        <?php endif; ?>
                                    <?php endfor; ?>
                                <?php elseif (($_GET["page"] == $total / PAGE) || ($_GET["page"] == $total / PAGE - 1) || ($_GET["page"] == $total / PAGE - 2) || ($_GET["page"] == $total / PAGE - 3)): ?>        
                                    <?php for ($i = $total / PAGE - $max_page; $i <= $total / PAGE; $i++): ?>
                                        <a href='index.php?page=<?php echo $i; ?> '><?php echo $i ?></a>
                                        <?php if ($_GET["page"] == $i): ?>
                                            <?php $keyword->begin; ?>
                                            <?php $keyword->end = PAGE; ?>
                                        <?php endif; ?>
                                    <?php endfor; ?>
                                <?php else : ?>
                                    <?php for ($i = $_GET["page"] - 3; $i <= $_GET["page"] + 3; $i++): ?>
                                        <a href='index.php?page=<?php echo $i; ?> '><?php echo $i ?></a>
                                        <?php if ($_GET["page"] == $i): ?>
                                            <?php $keyword->begin; ?>
                                            <?php $keyword->end = PAGE; ?>
                                        <?php endif; ?>
                                    <?php endfor; ?>
                                <?php endif; ?> 
                            <?php endfor; ?>                   
                            <a href="index.php?page=<?php echo $_GET['page'] + 1 ?>">Next</a>
                            <a href="index.php?page=<?php echo $total / PAGE ?>">Last</a>
                            <?php $keywords = $keyword->select($page); ?>
                            
                        </div>

                        <div id="bangone">
                            <table border="1px">
                                <tr class="a">                                   
                                    <td>name</td>
                                    <td>company_name</td>
                                    <td>description</td>
                                    <td>images</td>
                                    <td><--T--></td>
                                </tr>
                                <?php foreach ($keywords as $go): ?>
                                    <tr class="b">
                                        <td><?php echo $go['name']; ?></td>
                                        <td><?php echo $go['company_name']; ?></td>
                                        <td><?php echo substr($go['description'], 0, 100); ?></td>
                                        <td><img src="<?php echo$go['image'] ?>" with="100px" height="100px"></td>
                                        <td class="dk">
                                            <img src="public/image/notes_edit-1394601700.png" width="15px" height="15px">   <a href="upload_file.php?id=<?php echo $go['id']; ?>">Edit</a>
                                            <img src="public/image/Preview-1395024407.png" width="15px" height="15px"><a href="upload_file.php">View</a>
                                            <img src="public/image/folder_delete-1394601697.png" width="15px" height="15px"><a href="upload_file.php">Deleted</a>
                                        </td>
                                    </tr>
                                <?php endforeach; ?>
                            </table>
                        </div>
                    </section>
                    <div class="clear"></div>
                    <div id="top"><a href="index.php">Top</a></div>
                </header>
                <div class="clear"></div>
                <div id="boder"></div>
                <footer>
                    <p class="colleft">
                    <table class="o">
                        <tr>
                            <td>1.</td><td>NGUYỄN HOÀNG ANH THIÊN</td></tr>
                        <tr><td>2.</td><td>HUỲNH THỊ BÍCH VÂN</td></tr>
                        <tr> <td>3.</td><td>ĐOÀN THANH TÂN</td></tr>

                    </table>
                    </p>
                    <p class="colright">
                    <table class="colright">
                        <tr>
                            <td></td><td>CONTACT</td></tr>
                        <tr><td></td><td>TRƯỜNG CAO ĐẲNG CÔNG NGHỆ THỦ ĐỨC</td></tr>
                        <tr> <td></td><td>Proudly powered by Drupal. Designed by C12TDT Works</td></tr>
                    </table>
                    </p>
                </footer>
            </div>
        </div>
    </body>
</html>
